Action hook 'edit_post_{$post->post_type}'

in WP Core File wp-includes/comment.php at line 2830

View Source

edit_post_{$post->post_type}

Action Hook
Description
Fires immediately after a post's comment count is updated in the database.

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Action
Line Number 2830

Hook Parameters

Type Name Description
int $post_id Post ID.
int $new The new comment count.
int $old The old comment count.

Usage Examples

Basic Usage
<?php
// Hook into edit_post_{$post->post_type}
add_action('edit_post_{$post->post_type}', 'my_custom_function', 10, 3);

function my_custom_function($post_id, $new, $old) {
    // Your custom code here
}

Source Code Context

wp-includes/comment.php:2830 - How this hook is used in WordPress core
<?php
2825  	 * @param int $old     The old comment count.
2826  	 */
2827  	do_action( 'wp_update_comment_count', $post_id, $new, $old );
2828  
2829  	/** This action is documented in wp-includes/post.php */
2830  	do_action( "edit_post_{$post->post_type}", $post_id, $post );
2831  
2832  	/** This action is documented in wp-includes/post.php */
2833  	do_action( 'edit_post', $post_id, $post );
2834  
2835  	return true;

PHP Documentation

<?php
/**
	 * Fires immediately after a post's comment count is updated in the database.
	 *
	 * @since 2.3.0
	 *
	 * @param int $post_id Post ID.
	 * @param int $new     The new comment count.
	 * @param int $old     The old comment count.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.